# 计算工时差
import datetime


def companyTime(last_time):
    # 获取当前时间  
    now = datetime.datetime.now()
    # 将时间转换为字符串
    time_str1 = now.strftime("%Y-%m-%d 17:30:00")
    time_str2 = now.strftime("%Y-%m-%d " + last_time)
    date1 = datetime.datetime.strptime(time_str1, "%Y-%m-%d %H:%M:%S")
    date2 = datetime.datetime.strptime(time_str2, "%Y-%m-%d %H:%M:%S")
    delta = date2 - date1
    days = delta.days
    hours = delta.seconds // 3600
    minutes = (delta.seconds // 60) % 60 / 60.0
    total_time = round((hours + minutes), 2)
    print(time_str1)
    print(str(total_time))


# if __name__ == '__main__':
#     companyTime()

companyTime('18:54:00')

# now = datetime.datetime.now()
# print(now.strftime("%Y-%m-%d %H:%M:%S"))
# print(now.strftime("%Y-%m-%d %h:%M:%S"))